import Axios from "axios";
import md5 from 'js-md5';
import Qs from 'qs'
Axios.default.withCredentials=true;
/**
 * 系统认证接口
 */
export default {
    /**
     * 系统登陆
     */
    loginIn: function ({ loginName, password }) {
        const params={
        account : loginName,
        password : md5(password)
        };
    return Axios.post('/crawler/api/user/login',Qs.stringify(params) ,{headers: {'Content-Type': 'application/x-www-form-urlencoded'}});
    },
    /**
     * 退出登陆
     */
    loginOut: function () {
        console.log("退出登陆");
        return Axios.post('/crawler/api/user/loginOut');
    },
    /**
     * 记录登陆日志
     */ 
    loginLog: function ({ip,city,type}) {
        var param={
            ip:ip,
            city:city,
            type:type              
        };
        return Axios.post('/api/loginlog-api/save', param);
    }

}
